package com.qcit.common.utils

import com.google.gson.Gson

import java.io.Serializable

inline fun <reified T> String.toBean() : T? {
    try {
        val gson: Gson = Gson()
        return gson.fromJson<T>(this, T::class.java)
    }catch (e:Exception){
        return null
    }
}

fun Serializable.toJson():String?{
    try {
        val gson: Gson = Gson()
        return gson.toJson(this)
    }catch (e:Exception){
        return null
    }
}